#ifndef _USART_H
#define _USART_H
#include "stm32f10x_rcc.h"
#include "stm32f10x_gpio.h"
#include "stm32f10x_usart.h"
#include "stdio.h"

/*FORM LIUYANG*/
#define DEBUG 1
#if DEBUG
#define debug(fmt, args...) printf(fmt"\r\n", ##args)
#define assert(err,fmt, args...) if (!(err)) do {printf(fmt"/r/n", ##args); while(1);} while (0)
#define func_enter()  printf("enter %s/r/n", __func__)
#define func_exit()   printf("exit %s/r/n", __func__)
#else
#define debug(args...)
#define assert(args...)
#define func_enter()
#define func_exit()
#endif

#define CICLELEN 1024

extern uint8_t uartRecvBuf[1024];
extern uint16_t usWritePos;
extern uint16_t usReadPos;
extern uint8_t ucWriteCicleNum;
extern uint8_t ucReadCicleNum;
extern uint16_t usWriteLen;
extern uint16_t usReadLen;
extern uint8_t ucFlag_UART_FIFOOverFlow;


extern void USART1_Init(uint32_t Baudrate);
extern void USART2_Init(uint32_t Baudrate);
extern void USART_Send_Char(uint8_t ascii_code);
extern void uartDateLenUpdata(void);
void uartDataLenUpdata_read( void );
void uartDataLenUpdata_write( void );
extern void SendData(int ch);

extern unsigned char uartRecvBuf[CICLELEN];
extern unsigned char uartRecvCount;



#endif
